#include "../inc/Ui/TwitterUsernameProfileForm.h"
#include "../inc/Ui/WebForm.h"

using namespace Osp::Base;
using namespace Osp::Ui;
using namespace Osp::Ui::Controls;
int TwitterUsernameProfileForm::FormId = -1;

TwitterUsernameProfileForm::TwitterUsernameProfileForm(void) {
}

TwitterUsernameProfileForm::~TwitterUsernameProfileForm(void) {
}

bool TwitterUsernameProfileForm::Initialize() {
	Form::Construct(L"TwitterUserNameProfileForm");

	return true;
}

result TwitterUsernameProfileForm::OnInitializing(void) {
	result r = E_SUCCESS;

	this->SetSoftkeyActionId(SOFTKEY_1, ID_SOFTKEY_BACK);
	this->AddSoftkeyActionListener(SOFTKEY_1, *this);

	pEditAreaProfile = static_cast<EditArea*> (GetControl("IDC_EDITAREA1"));
	return r;
}

result TwitterUsernameProfileForm::OnTerminating(void) {
	result r = E_SUCCESS;

	// TODO: Add your termination code here

	return r;
}

void TwitterUsernameProfileForm::OnActionPerformed(
		const Osp::Ui::Control &source, int actionId) {
	FormManager *pFormManager = null;
	Form *pTwitterForm = null;
	FormManager::GetInstance(pFormManager);
	/*Frame* pFrameMain = Application::GetInstance()->GetAppFrame()->GetFrame();
	 WebForm* pWebForm = static_cast<WebForm*> (pFrameMain->GetControl(L"WebForm"));
	 */
	switch (actionId) {
	case ID_SOFTKEY_BACK: {
		pEditAreaProfile->SetText("");
		pFormManager->SetCurrentForm(MyFollowingForm::GetFormId());
		//pFrame->SetCurrentForm(*pFormParent);
		//pFormParent->RequestRedraw(true);
	}
		break;
	default:
		break;
	}

} /*
 void TwitterUsernameProfileForm::SetParentForm(Form *form) {
 this->pFormParent = form;

 }
 void TwitterUsernameProfileForm::SetFrame(Frame *frame) {
 this->pFrame = frame;
 }*/
void TwitterUsernameProfileForm::SetUserNameProfileToEditArea(String value,
		String location) {
	this->pEditAreaProfile->SetText(value);

	this->RequestRedraw(true);
}
void TwitterUsernameProfileForm::ThongBaoLoi(String value) {
	MessageBox msg;
	msg.Construct("Chào bạn ", value, MSGBOX_STYLE_OK, 3000);
	int i = 0;
	msg.ShowAndWait(i);

}
